home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9943 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.primenet.com!not-for-mail
  2. From: gbe@primenet.com (Gary Edstrom)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: protected access to grandparent class
  5. Date: 4 Mar 1996 10:49:01 -0700
  6. Organization: Sequoia Software
  7. Sender: root@primenet.com
  8. Message-ID: <313b2bb5.241312055@news.primenet.com>
  9. References: <Dnqstp.Jo9@uns.bris.ac.uk>
  10. X-Posted-By: ip079.lax.primenet.com
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. Inheritance can be only "public" or "private".
  14. NOT "protected"
  15.  
  16. Gary
  17.  
  18. nathan@pact.srf.ac.uk (Nathan Sidwell) wrote:
  19.  
  20. >The following class heirarchy is giving me grief.
  21. >-snip
  22. >class A {
  23. >protected:
  24. >  int member;
  25. >  void func(A){};
  26. >};
  27. >
  28. >class B : protected A {
  29.            ^^^^^^^^^   ONLY "private" or "public" are allowed here. 
  30. >protected:
  31. >  void func(B arg) {
  32. >    A::func(A(arg));      // ok
  33. >  };
  34. >};
  35. >
  36. >class C : protected B {
  37.            ^^^^^^^^^   ONLY "private" or "public" are allowed here. 
  38. >protected:
  39. >  void func(C arg) {
  40. >    A::func(A(arg));      // failed
  41. >  };
  42. >};
  43.  
  44. --
  45. Gary Edstrom <gbe@primenet.com> | Sequoia Software
  46. PO Box 9573                     | Programming & Technical Services
  47. Glendale CA 91226-0573          | PGP Key ID: 0x1A0D44BD
  48. PGP Fingerprint: 72 AA 4F 73 05 53 89 C6  8A EE F4 EE D1 C0 13 8D 
  49.